;
(function() {
  new Vue({
    el: '#feedback',
    data: {
      flag: true,
      orders: '#',
      columns: 'CT',
      pagetotal: 0,
      page: 1,
      limit: ['10'],
      pageCounts: [{name: '10', code: '10'}, {name: '15', code: '15'}, {name: '20', code: '20'}],
      modulesList: [],
      typelist: [],
      typeStatus: '',
      keyword: '',
      publishingType: '#',
      moduleId: [],
      data: [],
      erweimaflag: false,
      quanxian: JSON.parse(window.localStorage.getItem('permissions')),
    },
    filters: {
      framtTime(time) {
        return hlDateUtil.formatDate(time, 'yyyy-MM-dd HH:mm:ss')
      },
      formatDate: function(time) {
        if (time === undefined) return '--'
        return hlDateUtil.formatUTCDate(time, 'yyyy-MM-dd')
      },
    },
    methods: {
      //显示隐藏查询条件
      showHideTerm() {
        this.flag = !this.flag;
      },
      // 设置背景色
      addbgcolor(index) {
        let el = document.querySelectorAll('.house-two-tone');
        let el0 = document.querySelectorAll('.house-operate')
        el[index].classList.add('house-two-tone-hover')
        el0[index].classList.add('house-two-tone-hover')
      },
      //删除背景色
      removebgcolor(index) {
        let el = document.querySelectorAll('.house-two-tone');
        let el0 = document.querySelectorAll('.house-operate')
        el[index].classList.remove('house-two-tone-hover')
        el0[index].classList.remove('house-two-tone-hover')
      },
      //创建时间
      createTime() {
        setTimeout(() => {
          this.getListData();
        }, 300)
        this.orders = this.orders == '#'?'ASC':(this.orders == 'ASC'?'DESC':'ASC')
      },
      //新建信息
      createInfo() {
        hlUrlUtil.goTo('createInfo98k', {
          ddtab: true
        }, true)
      },
      //模块列表获取
      getmodules() {
        hlhttp.get({
          url: 'portal/modules',
          success: (data) => {
            this.modulesList = hlArrayUtil.replaceData(data, [{key: 'moduleName', rKey: 'name'}, {key: 'moduleId', rKey: 'code'}]);
          }
        })
      },
      //获取模块id
      eventModule(arr) {
        this.moduleId = [arr[0].code]
      },
      eventType(type) {
        this.typeStatus = type;
      },
      //展示数量
      eventPage(arr) {
        this.limit = [arr[0].code]
        this.getListData()
      },
      //重置
      reset() {
        this.keyword = '';
        this.moduleId = [];
        this.orders = 'ASC';
        this.columns = 'CT';
        this.page = 1;
        this.limit = ['10'];
        this.getListData()
      },
      //查询
      search() {
        this.page = 1
        this.limit = ['10'];
        this.getListData();
      },
      //获取文章列表
      getListData() {
        hlhttp.get({
          url: 'portal/article_feedbacks',
          data: {
            'keyword': this.keyword || '#',
            'module_id': this.moduleId.length ? this.moduleId[0] : '#',
            "orders": this.orders,
            "columns": this.columns,
            "page": this.page,
            "limit": this.limit[0]
          },
          success: (data) => {
            this.data = data;
            $("#page").initPage(data.totalPage, this.page, (n) => {
              if (this.page == n) {
                return
              }
              this.page = n;
              this.getListData();
            });
          }
        })
      },
      //去详情页面
      gotoDetail(id) {
        hlUrlUtil.goTo('feedbackDetail', {
          articleId: id,
          ddtab: true
        }, true)
      },
      getDetail(val) {
        hlhttp.get({
          url: 'portal/publishing',
          data: {
            portal_article_id: val
          },
          success: (data) => {

          }
        })
      }


    },
    created() {
      hlSelectUi()
    },
    mounted() {
      this.getmodules()
      this.getListData()
    }
  })
}())
